package com.nlx.notes.configuer.mybatisplus.code;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;

import java.nio.file.Paths;

public class CodeGenerator {

    public static void main(String[] args) {
        FastAutoGenerator.create("jdbc:mysql://139.199.194.32:3306/inc_exp_n_test", "nlx", "admin123456")
                .globalConfig(builder -> builder
                        .author("nlx")
                        .outputDir(Paths.get(System.getProperty("user.dir")) + "/src/main/java")
                        .commentDate("yyyy-MM-dd")
                )
                .packageConfig(builder -> builder
                        .parent("com.nlx.notes.module")
                        .entity("entity")
                        .mapper("mapper.")
                        .service("service.")
                        .serviceImpl("service.impl")
                        .xml("mapper.xml")
                )
                .strategyConfig(builder -> builder
                        .entityBuilder()
                        .enableLombok()
                        .addTableFills()
                )
                .strategyConfig(builder ->
                        builder.addInclude("user_category_modification") // 设置需要生成的表名
                )
                .templateEngine(new FreemarkerTemplateEngine())
                .execute();
    }

}
